// 引入公共组件
require('../less/commCss/basic.css')
// 引入文字样式
require('../fonts/iconfont.css')
// 引入当前css
require('../less/course-particulars.less')
const {
    $http
} = require('../lib/commonJs/http.js')
const utils = require('../lib/commonJs/utils.js')

// 是否登录
utils.isLogin()

/**
 * 获取元素
 */
const courseBodyTitle = document.querySelector('.course-body-title')
const courseBodyContent = document.querySelector('.course-body-content')
const calorie = document.querySelector('.calorie')
const timer = document.querySelector('.timer')
const frequency = document.querySelector('.frequency')
const instrument = document.querySelector('.instrument')

/**
 * 渲染信息
 */
function showMes(){
    $http.get(`/sports/courseDetail${location.search}`,function({status,data}){
        if(status === 0){
            courseBodyTitle.textContent = data.name
            courseBodyContent.textContent = data.desc
            calorie.textContent = data.calorie
            timer.textContent = data.time
            frequency.textContent = `每周${data.frequency}次`
            instrument.textContent = data.instrument
            localStorage.setItem('fragments',JSON.stringify(data.fragments))
        }
    })
}
showMes()